<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:68:"C:\wwwroot\xtgl\public/../application/admin\view\sysconfig\base.html";i:1670148044;s:57:"C:\wwwroot\xtgl\application\admin\view\public\header.html";i:1672305798;s:57:"C:\wwwroot\xtgl\application\admin\view\public\footer.html";i:1670148044;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo config('WEB_SITE_TITLE'); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/admin/js/layui/css/layui.css" >
    <link rel="stylesheet" href="/static/admin/layAdmin/css/admin.css" >
    <script src="/static/admin/js/jquery.js"></script>
    <script src="/static/admin/js/jquery.form.js"></script>
    <script src="/static/admin/js/jmzhfsform.js"></script>
    <script src="/static/admin/js/layui/layui.js"></script>
    <script src="/static/admin/js/jmzhclass.js?v=1.222"></script>
    <link href="/static/admin/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="/static/admin/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/static/admin/umeditor/umeditor.min.js"></script>

    <link href="/static/admin/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <link href="/static/admin/js/layui_exts/webupload/uploader/style.css" type="text/css" rel="stylesheet">
    <link href="/static/admin/js/layui_exts/webupload/uploader/webuploader.css" type="text/css" rel="stylesheet">

    <script src="/static/admin/js/tableExport.js"></script>

    <link href="/static/admin/js/plugins/wx-audio/wx-audio.css" type="text/css" rel="stylesheet">

    <!--<script src="/static/admin/js/layui/layui.all.js"></script>-->
    <!--&lt;!&ndash;<link rel="stylesheet" href="/static/admin/layAdmin/css/font-awesome.min.css">&lt;!&ndash;fontAwesome图标库&ndash;&gt;&ndash;&gt;-->

</head>
<body>
<div class="layui-fluid">
    <div class="layui-card" >
        <div class="layui-tab" lay-filter="settab">
            <ul class="layui-tab-title">
                <li class="layui-this">基本设置</li>
                <li>微信设置</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form" action="" id="baseset" lay-filter="baseset">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">系统名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="title" lay-verify="required|title" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">请填系统名称</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">LOGO</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload-drag" id="upload1">
                                        <i class="layui-icon"></i>
                                        <p>点击上传，或将文件拖拽到此处</p>
                                        <div class="layui-hide" id="uploadLogo">
                                            <hr>
                                            <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-mid layui-word-aux">请填上传LOGO</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">版权信息</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="copyright" lay-verify="copyright" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">请填写版权信息</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">备案信息</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="copyrighturl" lay-verify="copyrighturl" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">请填写备案信息</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="savedata1">保存设置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">

                    <form class="layui-form" action="" id="wxset" lay-filter="wxset">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">随机SALT</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="salt" lay-verify="salt" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label">微信用户表名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="tablename" lay-verify="tablename" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>

                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转域名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="domain" lay-verify="domain" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如http://www.baidu.com或为空（公众号需授权域名）</div>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">微信AppID</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="appid" lay-verify="appid" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">微信AppSecret</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="appsecret" lay-verify="appsecret" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">公众号需设置IP白名单</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">mch_id</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mch_id" lay-verify="mch_id" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">mch_id</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">key</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="key" lay-verify="key" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">key</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">支付回调地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="notifyurl" lay-verify="notifyurl" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">notifyurl</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">登录回调地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="returnurl" lay-verify="returnurl" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">returnurl</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">上传核验文件</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload-drag" id="upload2">
                                        <i class="layui-icon"></i>
                                        <p>点击上传，或将文件拖拽到此处</p>
                                        <div class="layui-hide" id="mp_verify">
                                            <hr>
                                            <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="mp_verify" value="">
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>

                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">商户key</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload-drag" id="upload3">
                                        <i class="layui-icon"></i>
                                        <p>点击上传，或将文件拖拽到此处</p>
                                        <div class="layui-hide" id="mch_key">
                                            <hr>
                                            <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="mch_key" value="">
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">商户cert</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload-drag" id="upload4">
                                        <i class="layui-icon"></i>
                                        <p>点击上传，或将文件拖拽到此处</p>
                                        <div class="layui-hide" id="mch_cert">
                                            <hr>
                                            <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="mch_cert" value="">
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="savedata2">保存设置</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>

    </div>

</div>

<style>
    .layui-form-label{
        width: 100px;
    }
    .layui-input-block {
        margin-left: 130px;
        min-height: 36px
    }
</style>

<div id="headCrop" style="display:none">
    <div class="tailoring-content-one">
        <label title="选择图片" for="chooseImg" class="layui-btn">
            <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg" class="hidden" onchange="selectImg(this)"><i class="fa fa-cloud-upload"></i>
            选择图片
        </label>
    </div>
    <div class="ibox-content">
        <div class="tailoring-content">
            <div class="tailoring-content-two">
                <div class="tailoring-box-parcel" style="text-align: center">
                    <img id="tailoringImg">
                    <span class="word" style="position:relative;top:50%;font-size:14px;color: #c2c2c2">仅支持JPG、JPEG、PNG格式的图片文件</span><br>
                    <!--<span class="size" style="position:relative;top:50%;font-size:16px">文件不能大于2MB</span>-->
                </div>
                <div class="preview-box-parcel">
                    <!--<p>图片预览：</p>-->
                    <div class="square previewImg"></div>
                    <div class="circular previewImg"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <span class="layui-btn cropper-reset-btn" style="float:left">复位</span>
        <span class="layui-btn zoomIn" style="float:left">放大</span>
        <span class="layui-btn zoomOut" style="float:left">缩小</span>
        <span class="layui-btn cropper-rotate-btn" style="float:left">旋转</span>
        <span class="layui-btn cropper-scaleX-btn" style="float:left">换向</span>
        <span class="layui-btn " id="sureCut"><i class="fa fa-save"></i> 保存</span>
        <span class="layui-btn layui-btn-primary" onclick="layer.closeAll()"><i class="fa fa-close"></i> 关闭</span>
    </div>
</div>


<script src="/static/admin/js/plugins/wx-audio/wx-audio.js" ></script><!--音频播放器组件-->

<script src="/static/admin/js/layui_exts/webupload/uploader/webuploader.js"></script>

<script src="/static/admin/layAdmin/js/Icon.js"></script><!--fontAwesome图标库-->
<script src="/static/admin/layAdmin/js/wk.js"></script><!--封装方法-->


<script>
    layui.config({
        base: '/static/admin/layAdmin/src/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
        ,formSelects: 'formSelects-v4'
    }).use(['index','formSelects']),function(){
        var formSelects = layui.formSelects
    };
</script>
<script>


    //关闭自动填充
    $('input').attr('autocomplete',"off");

    // //图片灯箱
    // function imgDisplay(obj) {
    //     var src = $(obj).attr("src");
    //     var imgHtml = '<div class="showP"><img src=' + src + ' style="margin-top: 120px;height:50%;margin-bottom:120px;"  /><p class="closeP"  onclick="closePicture(this)"><span class="cha">×</span></p></div>'
    //     $('body').append(imgHtml);
    // }
    //
    // //关闭图片灯箱
    // function closePicture(obj) {
    //     $(obj).parent("div").remove();
    // }

    //tips框
    $('#offAll').on('mouseover', function(){
        var that = this;
        layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 若未勾选默认禁用全部</span>', that,{tips: [2, '#F2F2F2'],time: 10000});
    });
    //tips框
    $('#onAll').on('mouseover', function(){
        var that = this;
        layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 若未勾选默认启用全部</span>', that,{tips: [2, '#F2F2F2',''],time: 10000});
    });
    //tips框
    $('#excel').on('mouseover', function(){
        var that = this;
        layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 导出筛选完成数据</span>', that,{tips: [2, '#F2F2F2',''],time: 10000});
    });
    //关闭tips框
    $('#offAll,#onAll,#export,#excel').on('mouseout', function(){
        layer.closeAll('tips');
    });

    //layui公共操作
    layui.use(['form','table'], function() {
        var form = layui.form
            ,table = layui.table
        //重置搜索框
        $('#empty').on('click', function () {
            $('.layui-input').val('');
            // $(".search").trigger("chosen:updated");
            $('select').each(function (i, j) {
                $(j).find("option:selected").attr("selected", false);
                form.render('select')
            })
        });
        //表格排序
        table.on('sort(LAY-table-manage)', function(obj){
            table.reload('LAY-table', {
                initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态
                ,where: { //请求参数
                    field: obj.field //排序字段
                    ,order: obj.type //排序方式
                }
            });
        });
        //监听搜索
        form.on('submit(LAY-search)', function (data) {
            //执行重载
            table.reload('LAY-table', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: data.field
            });
        });

    });
</script>
<script>
    layui.use(['form', 'upload','element', 'jquery'], function(){
        var $ = layui.$
            ,form = layui.form
            ,element = layui.element
            ,upload = layui.upload;
        getData(form,'base');//获取基本设置数据
        uploadimg(upload,'upload1','uploadLogo','base')//基本设置上传LOGO
        uploadimg(upload,'upload2','mp_verify','wx');//上传核验文件
        uploadimg(upload,'upload3','mch_key','wx');//商户key
        uploadimg(upload,'upload4','mch_cert','wx');//商户cert

        element.on('tab(settab)', function(elem){
            if(elem.index==1){
                getData(form,'wx')
            }
        });
        //监听状态操作
        form.on('submit(savedata1)', function(data){
            data.field.logo = $("#uploadLogo").find('img').attr('src');
            ajaxSavedata(data.field,'base')
            return false;
        });

        //监听提交
        form.on('submit(savedata2)', function(data){

            data.field.verifyfile = $("#verifyfile").find('img').attr('src');
            data.field.mch_key = $("#mch_key").find('img').attr('src');
            data.field.mch_cert = $("#mch_cert").find('img').attr('src');

            ajaxSavedata(data.field,'wx')
            return false;
        });
        form.render();
    });

    function getData(form,name) {
        var loadconfigurl = "<?php echo url('sysconfig/loadconfig'); ?>" + "?name="+name;

        $.ajax({
            type: "get",
            url: loadconfigurl,
            success: function (response) {
                if(response!=null&&response!=""){

                    if(name=='base'){
                        if(response.logo){
                            $('#uploadLogo').removeClass();
                            $('#uploadLogo').find('img').attr('src', response.logo);
                        }

                        form.val('baseset', {
                            "title": response.title
                            ,"copyright": response.copyright
                            ,"copyrighturl": response.copyrighturl
                        });
                    }else {
                        $('#mp_verify').removeClass();
                        $('#mch_key').removeClass();
                        $('#mch_cert').removeClass();

                        $('#mp_verify').find('img').attr('src', response.mp_verify);
                        $('#mch_key').find('img').attr('src', response.mch_key);
                        $('#mch_cert').find('img').attr('src', response.mch_cert);
                        form.val('wxset', {
                            "salt": response.salt
                            ,"tablename": response.tablename
                            ,"domain": response.domain
                            ,"appid": response.appid
                            ,"appsecret": response.appsecret
                            ,"mch_id": response.mch_id
                            ,"key": response.key
                            ,"notifyurl": response.notifyurl
                            ,"returnurl": response.returnurl
                            ,"mp_verify": response.mp_verify
                            ,"mch_key": response.mch_key
                            ,"mch_cert": response.mch_cert
                        });
                    }

                }

            }
        });
    }
    function uploadimg(upload,elemid,uploadid,name) {
        var uploadimgurl = "<?php echo url('/comm/upload/uploadimg'); ?>" + "?name="+name;
        upload.render({
            elem: '#'+elemid
            ,url: uploadimgurl //改成您自己的上传接口
            ,done: function(res){
                layer.msg('上传成功');
                layui.$('#'+uploadid).removeClass('layui-hide').find('img').attr('src', res.data);
            }
        });
    }

    function ajaxSavedata(data,name) {

        var postdata = JSON.stringify(data);
        var saveconfigurl = "<?php echo url('sysconfig/saveconfig'); ?>" + "?name="+name;

        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            url: saveconfigurl,
            data: postdata,
            success: function (response) {
                layer.msg('保存成功');
            }
        });

    }

</script>
</body>
</html>
